package com.ideaaedi.springcloud.jd.commonspring.enhancer;

import com.ideaaedi.springcloud.jd.commonds.entity.ExcelExportSettings;
import org.springframework.core.Ordered;
import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * excel导出执行器
 *
 * @author <font size = "20" color = "#3CAA3C"><a href="https://gitee.com/JustryDeng">JustryDeng</a></font> <img
 * src="https://gitee.com/JustryDeng/shared-files/raw/master/JustryDeng/avatar.jpg" />
 * @since 2021.0.1.F
 */
public interface ExcelExportExecutor extends Ordered {
    
    /**
     * 是否支持导出该类型的数据集为excel
     *
     * @param clazz 待导出的数据集的item的类型
     *
     * @return 是否支持
     */
    <T> boolean support(@NonNull Class<T> clazz);
    
    /**
     * 到处数据
     *
     * @param excelExportSettings excel导出设置
     * @param clazz dataList中item的类型
     * @param dataList 待导出的数据集
     * @param httpServletResponse http响应
     */
    <T> void export(@NonNull ExcelExportSettings excelExportSettings, @NonNull Class<T> clazz,
                    @Nullable List<T> dataList, @NonNull HttpServletResponse httpServletResponse);

}
